import java.util.Arrays;

public class bubblesort {
    public static void change(int[] args){

        for(int i=0;i<args.length-1;i++){
            boolean flg = true;
            for(int j=0 ; j<args.length-1-i ; j++){
                if(args[j]>args[j+1]){
                    int tmp = args[j];
                    args[j]=args[j+1];
                    args[j+1] = tmp;
                    flg = false;
                }
            }
            if(flg == true){
                return;
            }
        }
    }
    public static void main(String[] args) {
        int[] arr = {1,2,1,9,2,7,6,0,0,7};
        change(arr);
        for(int i=0;i<arr.length;i++){
            System.out.print(arr[i]+" ");
        }
        System.out.println();
        int[] arr2 = {2,9,1,3,1,5,1,6};
        change(arr2);
        int a = Arrays.binarySearch(arr2,1);
        System.out.println(a);
    }
}